$(function () {
    $('.am-header-title').text('形象搭配');

    function showalert(txt) {
        $("#modal-alert").find(".am-modal-bd").text(txt)
            .end()
            .modal("open");
    }

    $("#submit").click(function () {

        var face = $("input[name=face]:checked").val();
        var body = $("input[name=body]:checked").val();
        var user = JSON.parse(localStorage.getItem("userTmp"));
        var userId = user.id;
        var url = "/h5/setBody";

        if (face == null) {
            showalert("请设置脸型")
        }

        if (body == null) {
            showalert("请设置体型")
        }

        $.post(url, {
            faceStyle: face,
            bodyStyle: body,
            userId: userId
        }, function (result) {
            if (result.code != "000000") {
                window.location.href = "../../app/login/login.jsp";
            } else {
                window.location.href = "../../app/login/login.jsp";
            }

        })


    })
});

